package lab02.test11;

public class Square extends Rectangle{

double c;
    Square(double a, double b) {
        super(a, b);
    }

    public double getDiagonal(){

        c = Math.sqrt( a * a + b * b);
        return c;
    }

    public void printMyWay(){

        System.out.println("正方形的长 a = "+a+" 宽 b = "+b );
        System.out.println("面积 s = "+getArea());
        System.out.println("周长 l = "+getLength());
        System.out.println("对角线 d = "+getDiagonal());
    }
}

